<script type="text/javascript">
$(function(){
	var numberTemplate = {formatter: 'number', align: 'right', sorttype: 'number'};	 
	$("#tblData").jqGrid({
		url:'index.php?r=akademik/siswa/penempatan_kelas/listNoKelas',
		editUrl:'index.php?r=akademik/siswa/penempatan_kelas/edit',
		postData:{"department_id":"<?php echo $department_id; ?>","tahun_ajaran_id":<?php echo $tahun_ajaran_id; ?>,"activeOnly":1},
		datatype: 'JSON',
		loadonce:true,
		mtype:"GET",
		autowidth:true,
		height:"100%",
		altRows:true,
		ignoreCase:true,
		//$strFields="id,department_id,sid,name,if(gender='P','Pria','Wanita') as gender,birth_date,address,home_phone,handphone,email,ayah_nama,ibu_nama,wali_nama,is_active";
		colNames: ['id','SID','Nama','Jenis Kelamin','Action'],
		colModel: [
			{name: 'id', index: 'id', width: 20,hidden:false,sorttype:'int',formatter:'int'},
			{name: 'sid', index: 'sid', width: 40,search:true},
			{name: 'name', index: 'name', width: 150,search:true},
			{name: 'gender', index: 'gender', width: 60,search:true},
			{name: 'act', index: 'act', width: 50, align: 'center'},
			
		],
		gridview: true,
		rownumbers: false,
		rowNum: 10,
		rowList: [5, 10, 15],
		pager: '#navTblData',
		viewrecords: true,
		caption: 'Daftar Murid',
		jsonReader : { 
			root:"model",
			repeatitems: false			
		},
		loadComplete:function(data){
			console.log(data);
		},
		gridComplete: function(){ 
			var ids = jQuery("#tblData").getDataIDs(); 
			for(var i=0;i<ids.length;i++){ 
				var cl = ids[i]; 
				btnEdit = "<img title='edit' class='imgBtn' style='height:20px;width:20px;' src='images/action/Actions-arrow-right-double-icon.png' onclick='addToKelas(" + cl + ")' />"; 					
				jQuery("#tblData").setRowData(ids[i],{act:btnEdit}) 
			} 
		}
	});
	$("#tblData").jqGrid('navGrid','#navTblData',{add:false,edit:false,search:false,del:false,refresh:false});		
	//add search text
	$("#tblData").jqGrid('addSearchText',["sid","name","address"]);
	refreshGrid();

</script>
<div>
	<table id="tblData" name="tblData"></table>
	<div id="navTblData"></div>
</div>
<?php
	
?>